<%@ page language="java" import="java.util.*" pageEncoding="GB18030"
import="Reservation.UserBean,Application.Dao.ReservationDAO,DomainData.Reservation,java.util.Date,java.text.SimpleDateFormat"
%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>edit Reservation</title>

  </head>
  
  <body>
<%
		UserBean currentUser = (UserBean) session.getAttribute("currentSessionUser");
		if (currentUser == null) {
			response.sendRedirect("Login.jsp");
			return;
		}
		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");

		Date from = formatter.parse(request.getParameter("from"));
		Date to =  formatter.parse(request.getParameter("to"));
		int numberOfPeople = Integer.parseInt(request.getParameter("numberOfPeople"));
		int reservationID = Integer.parseInt(request.getParameter("reservationID"));
		int userID = currentUser.getUserID();
		Reservation reservation = new Reservation(reservationID,from,to,numberOfPeople,0,userID);
		System.out.println("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"+from.toString()+to.toString()+numberOfPeople+reservationID);
		int valid = ReservationDAO.modifyReservation(reservationID, from, to, numberOfPeople,reservation);
		
		out.println(valid);
		
			
 %>
  </body>
</html>
